﻿using System;
using System.Globalization;
using System.Windows.Data;

namespace MvvmEx.Converter
{
    /// <summary>
    /// 布尔值 反向转换器
    /// </summary>
    public class BoolToReverseBoolConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null) return Binding.DoNothing;

            return !bool.Parse(value.ToString());
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null) return Binding.DoNothing;

            return !bool.Parse(value.ToString());
        }
    }
}